package switchviz.gui.component;
import java.util.LinkedList;

import org.jdom.Element;


public abstract class IXMLFilter 
{
	protected LinkedList<String> _ignoreList = new LinkedList<String>();
	protected LinkedList<String> _allowList = new LinkedList<String>();
	
	public abstract String Extract(Element rawNode);
	
	public void allowName(String NodeName) 
	{
		if (_allowList.contains(NodeName))
			return;
		
		_allowList.add(NodeName);
	}

	public void ignoreName(String NodeName) 
	{
		if (_ignoreList.contains(NodeName))
			return;
		
		_ignoreList.add(NodeName);
	}
	
	public boolean checkIgnore(Element rawNode)
	{
		if(_allowList.size() > 0)
		{
			if (_allowList.contains(rawNode.getName())) 
				return false; 
			else
				return true;
		}
		if (_ignoreList.contains(rawNode.getName())) { return true; }
		return false;
	}
}
